import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ContactListComponent } from './contact-list/contact-list.component';
import { TagEditComponent } from './tag-edit/tag-edit.component';
import {TagListComponent} from './tag-list/tag-list.component';
import {LayoutComponent} from './layout/layout.component';
import {ContactEditComponent} from './contact-edit/contact-edit.component';
import {ContactNewComponent} from './contact-new/contact-new.component';
import {TagNewComponent} from './tag-new/tag-new.component';
import {SignupComponent} from './signup/signup.component';
import {SigninComponent} from './signin/signin.component';
import {TableComponent} from './table/table.component';
import {AuthGuard} from './auth-guard.service';
import {ChartsComponent} from './charts/charts.component';
import {DragsortComponent} from './dragsort/dragsort.component';
import { HeroFormComponent } from './hero-form/hero-form.component';
import { QiankunComponent } from './qiankun/qiankun.component';
import {  APP_BASE_HREF} from '@angular/common';
import { SpaComponent } from './spa/spa.component';
import { EmptyComponent } from '@worktile/planet';
import { Compoment1Component } from './compoment1/compoment1.component';
import { DemosComponent } from './pages/demos/demos.component';

const routes: Routes = [
  {
    path: 'p',
    component: LayoutComponent
  },
  {
    path: 'table',
    component: TableComponent
  },
  {
    path: 'charts',
    component: ChartsComponent
  },
  {
    path: 'drag-drop',
    component: DragsortComponent
  },
  {
    path: 'qiankun',
    component: QiankunComponent
  },
  {
    path: 'angular9',
    component: QiankunComponent
  },
  {
    path: 'angular9/:child',
    component: QiankunComponent
  },
  {
    path: 'qiankun/:url',
    component: QiankunComponent
  },
  {
    path: 'qiankun/:url/:url2',
    
    component: QiankunComponent
  },
  {
    path: 'spa',
    component: SpaComponent,
    children: [
      {
          path: '**',
          component: EmptyComponent
      }
  ]
  },
  {
    path: 'admin',
    component :SpaComponent,
  },
  {
    path: 'spa2',
    component: LayoutComponent,
    children:[

     {path:'',  component : SpaComponent,}
    ]
  },
  
  {
    path: 'contact', component: LayoutComponent,
    canActivate: [AuthGuard],
    children: [
      {
        path: '', component: ContactListComponent
      },
      {
        path: 'new', component: ContactNewComponent
      },
      {
        path: 'edit/:id', component: ContactEditComponent
      },
    
    ]
  },
  {
    path: 'tag', component: LayoutComponent,
    canActivate: [AuthGuard],
    children : [
      {
        path: '', component: TagListComponent
      },
      {
        path: 'edit/:id', component: TagEditComponent
      },
      {
        path: 'new', component: TagNewComponent
      }
    ]
  },
  {
    path: 'demos', component: LayoutComponent,children: [
      {
        path: 'tabs' , component: DemosComponent
      }
    ]
  },
  {
    path: 'signup', component: SignupComponent
  },
  {
    path: 'signin', component: SigninComponent
  },
  {
    path: 'form',
    component: HeroFormComponent

  },
  {
    path: 'menu',
    component: Compoment1Component

  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
  providers: [AuthGuard ,
    {provide: APP_BASE_HREF, useValue: ''}]
})
export class AppRoutingModule { }
console.log(AppRoutingModule);

// @ts-ignore
  // node = node2 ;
   
